/**
 * 
 */
package business;

import java.util.*;

import dbAccess.*;
import exceptions.*;

import model.*;

/**
 * @author Anthares & Hennek
 *
 */
public class SyllabusManager {
	private SyllabusDBAccess sdba = new SyllabusDBAccess();
	private LotDBAccess ldba = new LotDBAccess();
	private double prix = -1;
	/**
	 * @param annee
	 * @param section_id
	 * @return
	 * @throws PasIdentificationException 
	 * @throws DatabaseErrorException 
	 * @throws InvalidDataException 
	 */
	public ArrayList<Syllabus> getSyllabus(int annee, int section_id) throws PasIdentificationException, DatabaseErrorException, InvalidDataException {
		if(annee<0||annee>3||section_id<0) throw new InvalidDataException();
		return sdba.getSyllabus(annee,section_id);
	}
	public double getPrixSyllabus(Syllabus s) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		if(s==null) throw new InvalidDataException();
		if(prix==-1) prix = ldba.getLastLot().getImprimeur().getPrix();
		return (s.getNb_page()*prix)+0.5;
	}
	public HashMap<Syllabus, Integer> getSyllabusCommandeEtu(String status) throws PasIdentificationException, DatabaseErrorException{
		return sdba.getSyllabusCommandeEtu(status);
	}
}
